<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
	  xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
	<style type="text/css">

		a:hover {
			text-decoration: none;
		}

		.bgc-w {
			background-color: #fff;
		}
		.red{
			color:#d9534f;
			font-weight:100;
			font-size:1px;
		}
	</style>
</head>
<body>
<div th:replace="common/commoncss :: commoncss"></div>

<div class="row" style="padding-top: 10px;">
	<div class="col-md-2">
		<h1 style="font-size: 24px; margin: 0;" class="">通知管理</h1>
	</div>
	<div class="col-md-10 text-right">
		<a href="##"><span class="glyphicon glyphicon-home"></span> 首页</a> > <a
			disabled="disabled">通知管理</a>
	</div>
</div>
<div class="row" style="padding-top: 15px;">
	<div class="col-md-12">
		<!--id="container"-->
	
		<div class="bgc-w box">
			<!--盒子头-->
			<div class="box-header">
				<h3 class="box-title">
					<a href="javascript:history.back();" class="label label-default"
						style="padding: 5px;"> <i
						class="glyphicon glyphicon-chevron-left"></i> <span>返回</span>
					</a>
				</h3>
			</div>
			<form th:action="@{/notice/save}" method="post" id="thisForm">
				<!--盒子身体-->
				<div class="box-body no-padding">
					<div class="box-body">
						<div class="row">
							<input type="hidden" th:value="${aoaNoticeList.noticeId}" name="noticeId">
							<div class="col-md-6 form-group">
								<label class="control-label"><span>类型</span></label> 
								<select class="form-control" name="type" >
<!--									<option th:if="${aoaNoticeList.type != null}" th:value="${aoaNoticeList.type}" th:text="${#typeDict.getTypeName('inform',aoaNoticeList.type)}"></option>-->
									<option th:each="type:${typeList}"
											th:selected="${type.sortValue == aoaNoticeList.type}"
											th:value="${type.sortValue}"
											th:text="${type.typeName}">
									</option>
								</select>
							</div>
							<div class="col-md-6 form-group">
								<label class="control-label"><span>状态</span></label> 
								<select class="form-control" name="status">
<!--									<option th:if="${aoaNoticeList.status != null}" th:value="${aoaNoticeList.status}" th:text="${#statusDict.getStatusName('inform',aoaNoticeList.status)}"></option>-->
									<option th:each="status:${statusList}"
											th:selected="${status.sortValue == aoaNoticeList.status}"
											th:value="${status.sortValue}"
											th:text="${status.statusName}">
									</option>
								</select>
							</div>
							<div class="col-md-6 form-group">
								<label class="control-label"><span>标题</span></label>
								 <input class="form-control" th:value="${aoaNoticeList.title}" name="title"/>
							</div>
							<div class="col-md-6 form-group">
								<label class="control-label"><span>链接</span></label> 
								 <input	class="form-control" th:value="${aoaNoticeList.url}" name="url"/>
							</div>
							<div class="col-md-6 form-group">
								<label class="control-label"><span>描述</span></label> 
								<textarea class="form-control text" rows="5" cols="20" name="content" th:text="${aoaNoticeList.content}"></textarea>
							</div>
							<div class="col-md-6 form-group">
								<label class="control-label"><span>置顶</span></label><br>
									<span class="labels" th:if="${aoaNoticeList.isTop == 1}">
										<label>
											<input name="Top" type="checkbox" checked >
											<i>✓</i>
										</label>
									</span>
									<span class="labels" th:if="${aoaNoticeList.isTop != 1}" >
										<label>
											<input name="Top" type="checkbox" >
											<i>✓</i>
										</label>
									</span>
<!--								<span class="labels">-->
<!--									<label >-->
<!--										<input name="isTop" type="checkbox"  th:if="${aoaNoticeList.isTop != 1}" >-->
<!--										<i>✓</i>-->
<!--									</label>-->
<!--								</span>-->

							</div>

						</div>
				</div>
				</div>

				<!--盒子尾-->
				<div class="box-footer">
					<input class="btn btn-primary" id="save" type="submit" value="保存" />
					<input class="btn btn-default" id="cancel" type="button" value="取消"
						onclick="window.history.back();" />
				</div>
			</form>
		</div>

	</div>
</div>

<!--<div th:replace="common/modalTip :: modalTip"></div>-->

<script type="text/javascript">

$('.successToUrl').on('click',function(){
	window.location.href='/infrommanage';
});
//表单提交前执行的onsubmit()方法；返回false时，执行相应的提示信息；返回true就提交表单到后台校验与执行
function check() {
	console.log("开始进入了");
	//提示框可能在提交之前是block状态，所以在这之前要设置成none
	$('.alert-danger').css('display', 'none');
	var isRight = 1;
	$('.form-control').each(function(index) {
		// 如果在这些input框中，判断是否能够为空
		if ($(this).val() == "") {
			// 排除哪些字段是可以为空的，在这里排除
			if (index == 3 || index == 4) {
				return true;
			}
			if(index == 3){
				
			}
			// 获取到input框的兄弟的文本信息，并对应提醒；
			 var brother = $(this).siblings('.control-label').text();
			var errorMess = "[" + brother + "输入框信息不能为空]";
			// 对齐设置错误信息提醒；红色边框
			$(this).parent().addClass("has-error has-feedback");
			$('.alert-danger').css('display', 'block');
			// 提示框的错误信息显示
			$('.error-mess').text(errorMess);
			// 模态框的错误信息显示
			$('.modal-error-mess').text(errorMess);
			isRight = 0;
			return false;
		} else {
			// 在这个里面进行其他的判断；不为空的错误信息提醒
			return true;
		}
	});
	if (isRight == 0) {
		//modalShow(0);
		 return false;
	} else if (isRight == 1) {
		//modalShow(1);
		 return true;
	}
//	return false;
}
</script>
</body>
</html>
